import { defineStore } from "pinia";
import { basicConsoleKey } from "../key";
import { BasicConsoleApiModel } from "@/type/console/basicConsole";

interface IBasicState {
  basicConsoleState: BasicConsoleApiModel

}

export const useBasicStore = defineStore(basicConsoleKey, {
  state(): IBasicState {
    return {
      basicConsoleState: {
        start: { mainPage: "", openPage: "", selector: 1 },
        search: {
          searchSector: 3,
          selectionForSearchBar: false,
          autoRecommendWords: false,
          showAddressBarSuggest: false
        },
        defaultBrowser: {
          setDefaultBrowser: false
        }
      }
    }
  }

  ,
  actions: {
    updateBasicConsole(basicConsole: BasicConsoleApiModel) {
      this.basicConsoleState = basicConsole;
    }
  },
  getters: {

    getBasicConsole(state) { return state.basicConsoleState }

  },
  persist: {

    pick: ["basicConsoleState"]
  },
});